package sudoku;
import java.util.*;

class MyTimer extends TimerTask
{

 private Timer timer;
 private int time;

 MyTimer(Timer timer,int time)
 {
  this.time=time;
  this.timer=timer;
 }
 
 public void run()
 {
	 if(this.time!=0)
	 {
		 if(this.time%60==0)
			 System.out.printf("Remain %d minutes ! ",this.time/60);
	 
		 if(this.time==30)
				 System.out.printf("Remain %d seconds ! ",this.time);
	 }
	 
	 this.time--;
  
	 if(this.time<0)
	 {
		 System.out.println("\nTimes up! Gameover"); 
		 this.timer.cancel();
		 System.exit(0);
	 }
}
}

